<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vue示例</title>
<script src="https://cdn.bootcdn.net/ajax/libs/vue/3.2.40/vue.global.js"></script>
</head>
<body>
<div id="app">
    <btn-component></btn-component>
    <btn-component></btn-component>
    <btn-component></btn-component>
    <inner-component></inner-component>
    <inner-component/>
    <!-- <InnerComponent/> -->
</div>

<template id="tem1">
        <button>i am {{str}}</button>
</template>

<template id="tem2">
    <div>
        <h1>{{str}}</h1>
    </div>
</template>

<script>
    const com1 ={    //子组件
    template:'#tem1',
    data() {
        return {
            str:'btn',
        }
    },
};

const InnerComponent={
    name:'myComponent',
    data() {
        return {
            str:123
        }
    },
    template:'#tem2'
}

const app = Vue.createApp({
data() {
return {};
},
components:{
InnerComponent
},
})
app.component('btn-component',com1)

app.mount("#app");


</script>
</body>
</html>